home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10311 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: howland.reston.ans.net!torn!nott!cunews!wabakimi!abelo
  2. From: abelo@chat.carleton.ca (Andrew Belo)
  3. Newsgroups: comp.lang.c
  4. Subject: floats in borland C++ 4.5
  5. Date: 16 Mar 1996 18:48:44 GMT
  6. Organization: Carleton University, Ottawa, Canada
  7. Message-ID: <4if2ec$scg@bertrand.ccs.carleton.ca>
  8. NNTP-Posting-Host: wabakimi.carleton.ca
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11.  
  12. When ever I write a program that uses float or doubles I get errors such
  13. as floating point library not linked or stack fault.  These errors do not
  14. happen when I am compiling my files the happen when I am actualy running
  15. the program!  I will post some code to give you an example.  WHen running
  16. this code it gives the following message
  17. Floating point error: Stack
  18. fault.  Abnormal termination.
  19.  
  20.    when this function is called:
  21.  
  22. void bubblesort( double *dblarray, int numberOfElements)
  23.  
  24. {
  25.     int top, search, temp; 
  26.  
  27.     for( top = 0; top < numberOfElements -1; top++)
  28.         for(search = top +1; search < numberOfElements; search++)
  29.             if(dblarray[search] > dblarray[top])
  30.             {
  31.                 temp = dblarray[search];
  32.                 dblarray[search] = dblarray[top];
  33.                 dblarray[top] = temp; 
  34.             }
  35.  
  36. }
  37.  
  38. Thanx for any help that can be given!
  39.  
  40.